const app = getApp()
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    // 传入索引
    active: {
      type: Number,
      data: 0
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    active: 0,
    // 页面绑定路由
    list: [{
        name: "首页",
        path: "/pages/index/index",
        i: "home-o"
      },
      {
        name: "包裹列表",
        path: "/pages/package/index",
        i: "apps-o"
      },

      {
        name: "我的",
        path: "/pages/center/index",
        i: "user-o"
      }

    ]
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onChange(event) {
      //点击切换页面
      let list = this.data.list
      console.log(list[event.detail].path)
      wx.switchTab({
        url: list[event.detail].path
      })
    },
  },
  ready() {

    const query = wx.createSelectorQuery().in(this);
    query.select('.tabbar-item').boundingClientRect((res) => {
      app.globalData.tabbarHeight = res.height
    }).exec()

  }
})